<?php
namespace Tbf\Bundle\TestBundle\Tests;
class ArrayEqualTest extends TestBundleTest
{
    public function testAssertArrayUnOrderSubMatrix()
    {
        $test_case_list = array(
            array(
                'small'=>array('a'=>array('d'=>'a')),
                'big'=>array('b'=>array('d'=>'a')),
                'result'=>true
            ),
            array(
                'small'=>array('a'=>array('d'=>'1')),
                'big'=>array('b'=>array('d'=>1)),
                'result'=>true
            ),
            array(
                'small'=>array('a'=>array('d'=>'1')),
                'big'=>array('b'=>array('d'=>1,'c'=>2)),
                'result'=>true
            ),
            array(
                'small'=>array('a'=>array('d'=>'1','c'=>'a')),
                'big'=>array('b'=>array('d'=>1)),
                'result'=>false
            ),
            array(
                'small'=>array('a'=>array('d'=>0)),
                'big'=>array('b'=>array('d'=>null)),
                'result'=>false
            ),
            array(
                'small'=>array(
                    array('d'=>0,'c'=>9),
                    'a'=>array('d'=>0),
                    array('d'=>null),
                    array('d'=>0),
                    array('d'=>0),
                    array('d'=>0),
                    array('d'=>0),
                    array('d'=>0),
                    array('d'=>0),
                    array('d'=>0),
                    array('d'=>0),
                    array('d'=>0),
                    array('d'=>0,'c'=>5),

                ),
                'big'=>array(
                    'b'=>array('d'=>null),
                    array('d'=>0),
                    array('d'=>0,'c'=>5),
                    array('d'=>0,'c'=>9),
                    array('d'=>0),
                    array('d'=>0),
                    array('d'=>0),
                    array('d'=>0),
                    array('d'=>0),
                    array('d'=>0),
                    array('d'=>0),
                    array('d'=>0),
                    array('d'=>0),
                ),
                'result'=>true
            ),
            array(
                'small'=>array(
                    array('d'=>0),
                    array('d'=>0,'c'=>5),

                ),
                'big'=>array(
                    array('d'=>0,'c'=>5),
                    array('d'=>0),
                ),
                'result'=>true
            ),
            array(
                'small'=>array(
                    'a'=>array('d'=>0),
                    array('d'=>null),
                    array('d'=>null)
                ),
                'big'=>array(
                    'b'=>array('d'=>null),
                    array('d'=>0,'c'=>5)
                ),
                'result'=>false
            ),
        );
        foreach ($test_case_list as $test_case) {
            try {
                $this->assertArrayUnOrderSubMatrix($test_case['small'],$test_case['big']);
                $this->assertSame($test_case['result'],true);
            } catch (\PHPUnit_Framework_AssertionFailedError $e) {
                $this->assertSame($test_case['result'],false);
            }
        }
    }
}
